package com.dao.impl;

import java.util.HashMap;
import java.util.Map;

import com.beans.Position;
import com.beans.User;
import com.dao.PositionDao;
import com.vo.Page;

public class PositionDaoImpl extends UniversalDaoImpl implements PositionDao {

	
	public Page queryList(int pageNo, int pageSize, Position p) {
		String sql="select p.id,companyID,c.cname company,dbo.getCodeName('zw',name) name,dbo.getCodeName('1',region) region,dbo.getCodeName('2',sex) sex,wages,dbo.getCodeName('5',workType) workType,persons,days,createtime,detail,orderid,p.views from j_position p left join j_company c on p.companyID=c.id where 1=1";
		Map param=new HashMap();
		if(p.getCompany()!=null&&p.getCompany().getId()>0)param.put("companyId=?", p.getCompany().getId());
		if(p.getDetail()!=null&&!"".equals(p.getDetail()))param.put("detail like ?", "%"+p.getDetail()+"%");
		if(p.getName()!=null&&!"".equals(p.getName()))param.put("name like ?", p.getName()+"%");
		if(p.getId()>0)param.put("p.id=?", p.getId());
		if(p.getRegion()!=null&&!"".equals(p.getRegion()))param.put("region like ?", p.getRegion()+"%");
		return Page(pageNo, pageSize, sql,"id", param);
	}
}